import QtQuick
import QtQuick.Controls

/*
  手动加工界面
*/

Item {
    id:manualProcessBack
    width: screenWidth
    height: screenHeight - 300

    Rectangle{      // 顶部参数显示部分
        anchors.horizontalCenter: manualProcessBack.horizontalCenter
        width: manualProcessBack.width - 60
        height: manualProcessBack.height * 0.3
        radius: 5
        color: "#00CED1"
        border.width: 1
        border.color: "#000000"
        gradient:
            Gradient{
                GradientStop{ position: 0.0 ; color: "#00BFFF"}
                GradientStop{ position: 0.2 ; color: "#87CEFA"}
                GradientStop{ position: 0.4 ; color: "#87CEEB"}
                GradientStop{ position: 0.6 ; color: "#B0E0E6"}
                GradientStop{ position: 0.8 ; color: "#F0FFFF"}
        }


        A_InputWindow{      // 设定料长
            id: materialLong_Setting
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.top: parent.top
            anchors.topMargin: 30
            backWidth: 600
            backHeight: 80
            titleWidth: 200
            titleHeight: 70
            titleContent: qsTr("料  长")
            titleMargin: 100
            showWidth: 300
            showHeight: 70

            onInputContentChanged: {
                console.log(inputContent)
            }

        }


        A_Button{       // 料高选择界面 - 切换按钮
            id:chooseMaterialHeight
            anchors.left: materialHeight_Setting.left
            // anchors.leftMargin: 230
            anchors.verticalCenter: materialHeight_Setting.verticalCenter
            buttonWidth: 200
            buttonHeight: 70
            buttonRadius: 5
            buttonContent: qsTr("料高设定")
            contentColor: "white"
            buttonBorder: 3
            buttonBorderColor: "black"

            onButtonPressed: {
                chooseMaterialHeight.gradientColor = pressedColor
            }

            onButtonReleased: {
                chooseMaterialHeight.gradientColor = releasedColor
            }

        }

        A_InputWindow{      // 设定料高
            id: materialHeight_Setting
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.top: parent.top
            anchors.topMargin: 140
            backWidth: 600
            backHeight: 80
            titleWidth: 200
            titleHeight: 70
            // titleContent: qsTr("料  高")
            titleMargin: 100
            showWidth: 300
            showHeight: 70

            onInputContentChanged: {
                console.log(inputContent)
            }

        }

        A_InputWindow{      // 设定段数
            id: materialSections_Setting
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.top: parent.top
            anchors.topMargin: 250
            backWidth: 600
            backHeight: 80
            titleWidth: 200
            titleHeight: 70
            titleContent: qsTr("设定段数")
            titleMargin: 100
            showWidth: 300
            showHeight: 70

            onInputContentChanged: {
                console.log(inputContent)
            }

        }

        A_InputWindow{      // 当前段数
            id: materialSections_Current
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.top: parent.top
            anchors.topMargin: 360
            backWidth: 600
            backHeight: 80
            titleWidth: 200
            titleHeight: 70
            titleContent: qsTr("当前段数")
            titleMargin: 100
            showWidth: 300
            showHeight: 70

            onInputContentChanged: {
                console.log(inputContent)
            }

        }



        A_Button{           // 打印机设定 - 切换按钮
            id:printSettingWindow
            anchors.right: parent.right
            anchors.rightMargin: 80
            anchors.bottom: parent.bottom
            anchors.bottomMargin: 50
            buttonWidth: 130
            buttonHeight: 70
            buttonContent: qsTr("打印")
            contentColor: "white"
            buttonBorder: 3
            buttonRadius: 5

            onButtonPressed: {
                printSettingWindow.gradientColor = pressedColor
            }

            onButtonReleased: {
                printSettingWindow.gradientColor = releasedColor
            }

        }

    }


    Rectangle{      // 中部 锯头切换部分
        anchors.horizontalCenter: manualProcessBack.horizontalCenter
        anchors.top: manualProcessBack.top
        anchors.topMargin: 530
        width: manualProcessBack.width - 60
        height: manualProcessBack.height * 0.15
        radius: 5
        color: "#00CED1"
        border.width: 1
        border.color: "#000000"

        gradient:           // 渐变色属性
            Gradient{
                GradientStop{ position: 0.0 ; color: "#00BFFF"}
                GradientStop{ position: 0.2 ; color: "#87CEFA"}
                GradientStop{ position: 0.4 ; color: "#87CEEB"}
                GradientStop{ position: 0.6 ; color: "#B0E0E6"}
                GradientStop{ position: 0.8 ; color: "#F0FFFF"}
        }

        Rectangle{      // 左锯指示
            id:leftSaw
            width: 150
            height: 150
            radius: 150
            anchors.top: parent.top
            anchors.topMargin: 20
            anchors.left: parent.left
            anchors.leftMargin: 100
            border.width: 5
            border.color: "lightgray"
            color: currentState ? "red" : "white"

            property bool currentState : false

            MouseArea{
                anchors.fill: parent

                onClicked: {
                    console.log("左锯-选中")
                    leftSaw.currentState = true
                    bothSaw.currentState = false
                    rightSaw.currentState = false
                }
            }


        }

        Rectangle{      // 联动指示
            id:bothSaw
            width: 150
            height: 150
            radius: 150
            anchors.top: parent.top
            anchors.topMargin: 20
            anchors.horizontalCenter: parent.horizontalCenter
            border.width: 5
            border.color: "lightgray"
            color: currentState ? "red" : "white"

            property bool currentState : false

            MouseArea{
                anchors.fill: parent

                onClicked: {
                    console.log("联动-选中")
                    leftSaw.currentState = false
                    bothSaw.currentState = true
                    rightSaw.currentState = false
                }
            }
        }

        Rectangle{      // 右锯指示
            id:rightSaw
            width: 150
            height: 150
            radius: 150
            anchors.top: parent.top
            anchors.topMargin: 20
            anchors.right: parent.right
            anchors.rightMargin: 100
            border.width: 5
            border.color: "lightgray"
            color: currentState ? "red" : "white"

            property bool currentState : false

            MouseArea{
                anchors.fill: parent

                onClicked: {
                    console.log("右锯-选中")
                    leftSaw.currentState = false
                    bothSaw.currentState = false
                    rightSaw.currentState = true
                }
            }

        }



        Text{
            anchors.horizontalCenter: leftSaw.horizontalCenter
            anchors.top: leftSaw.bottom
            anchors.topMargin: 20
            font.pixelSize: 30
            font.bold: true
            text: qsTr("左锯")
        }

        Text{
            anchors.horizontalCenter: bothSaw.horizontalCenter
            anchors.top: bothSaw.bottom
            anchors.topMargin: 20
            font.pixelSize: 30
            font.bold: true
            text: qsTr("联动")
        }

        Text{
            anchors.horizontalCenter: rightSaw.horizontalCenter
            anchors.top: rightSaw.bottom
            anchors.topMargin: 20
            font.pixelSize: 30
            font.bold: true
            text: qsTr("右锯")
        }


    }

    Rectangle{      // 中下部 机头控制区
        anchors.horizontalCenter: manualProcessBack.horizontalCenter
        anchors.top: manualProcessBack.top
        anchors.topMargin: 810
        width: manualProcessBack.width - 60
        height: manualProcessBack.height * 0.3
        radius: 5
        // color: "#00CED1"
        border.width: 1
        border.color: "#000000"
        gradient:           // 渐变色属性
            Gradient{
                GradientStop{ position: 0.0 ; color: "#00BFFF"}
                GradientStop{ position: 0.2 ; color: "#87CEFA"}
                GradientStop{ position: 0.4 ; color: "#87CEEB"}
                GradientStop{ position: 0.6 ; color: "#B0E0E6"}
                GradientStop{ position: 0.8 ; color: "#F0FFFF"}
        }


        Text{           //  左机头标题
            id:leftMachineTitle
            anchors.top: parent.top
            anchors.topMargin: 20
            anchors.left: parent.left
            anchors.leftMargin: 200
            font.pixelSize: 50
            font.bold: true
            text: qsTr("左机头")
        }

        A_Button{
            id:leftSaw45_Btn
            anchors.horizontalCenter: leftMachineTitle.horizontalCenter
            anchors.top: leftMachineTitle.bottom
            anchors.topMargin: 100
            buttonWidth: 300
            buttonHeight: 80
            buttonContent: qsTr("45°")
            fontSize: 50
            contentColor: "white"
            buttonBorder: 3
            buttonBorderColor: "#d3d3d3"

            onButtonPressed: {
                leftSaw45_Btn.gradientColor = pressedColor
                leftSaw90_Btn.gradientColor = releasedColor

            }

        }


        A_Button{
            id:leftSaw90_Btn
            anchors.horizontalCenter: leftSaw45_Btn.horizontalCenter
            anchors.top: leftSaw45_Btn.bottom
            anchors.topMargin: 100
            buttonWidth: 300
            buttonHeight: 80
            buttonContent: qsTr("90°")
            fontSize: 50
            contentColor: "white"
            buttonBorder: 3
            buttonBorderColor: "#d3d3d3"

            onButtonPressed: {
                leftSaw90_Btn.gradientColor = pressedColor
                leftSaw45_Btn.gradientColor = releasedColor
            }
        }



        Rectangle{
            width: 3
            height: parent.height * 0.90
            anchors.top: parent.top
            anchors.topMargin: 20
            anchors.horizontalCenter: parent.horizontalCenter
            color: "black"
        }

        Text{           //  右机头标题
            id:rightMachineTitle
            anchors.top: parent.top
            anchors.topMargin: 20
            anchors.right: parent.right
            anchors.rightMargin: 200
            font.pixelSize: 50
            font.bold: true
            text: qsTr("右机头")
        }

        A_Button{
            id:rightSaw45_Btn
            anchors.horizontalCenter: rightMachineTitle.horizontalCenter
            anchors.top: rightMachineTitle.bottom
            anchors.topMargin: 100
            buttonWidth: 300
            buttonHeight: 80
            buttonContent: qsTr("45°")
            fontSize: 50
            contentColor: "white"
            buttonBorder: 3
            buttonBorderColor: "#d3d3d3"

            onButtonPressed: {
                rightSaw45_Btn.gradientColor = pressedColor
                rightSaw90_Btn.gradientColor = releasedColor
            }
        }

        A_Button{
            id:rightSaw90_Btn
            anchors.horizontalCenter: rightSaw45_Btn.horizontalCenter
            anchors.top: rightSaw45_Btn.bottom
            anchors.topMargin: 100
            buttonWidth: 300
            buttonHeight: 80
            buttonContent: qsTr("90°")
            fontSize: 50
            contentColor: "white"
            buttonBorder: 3
            buttonBorderColor: "#d3d3d3"

            onButtonPressed: {
                rightSaw45_Btn.gradientColor = releasedColor
                rightSaw90_Btn.gradientColor = pressedColor
            }
        }

    }


    Rectangle{      // 底部功能区
        anchors.horizontalCenter: manualProcessBack.horizontalCenter
        anchors.top: manualProcessBack.top
        anchors.topMargin: 1340
        width: manualProcessBack.width - 60
        height: manualProcessBack.height * 0.1
        radius: 5
        // color: "#00CED1"
        border.width: 1
        border.color: "#000000"
        gradient:           // 渐变色属性
            Gradient{
                GradientStop{ position: 0.0 ; color: "#00BFFF"}
                GradientStop{ position: 0.2 ; color: "#87CEFA"}
                GradientStop{ position: 0.4 ; color: "#87CEEB"}
                GradientStop{ position: 0.6 ; color: "#B0E0E6"}
                GradientStop{ position: 0.8 ; color: "#F0FFFF"}
        }


        A_Button{       // 压紧按钮
            id: pressBtn
            anchors.left: parent.left
            anchors.leftMargin: 20
            anchors.verticalCenter: parent.verticalCenter
            buttonWidth: 170
            buttonHeight: 90
            buttonContent: qsTr("压 紧")
            fontSize: 30
            contentColor: "white"
            buttonBorder: 2
            buttonBorderColor: "#d3d3d3"

            onButtonPressed: {
                pressBtn.gradientColor = pressedColor
            }

            onButtonReleased: {
                pressBtn.gradientColor = releasedColor
            }

        }

        A_Button{       // 定位按钮
            id: locationBtn
            anchors.left: parent.left
            anchors.leftMargin: 220
            anchors.verticalCenter: parent.verticalCenter
            buttonWidth: 170
            buttonHeight: 90
            buttonContent: qsTr("定 位")
            fontSize: 30
            contentColor: "white"
            buttonBorder: 2
            buttonBorderColor: "#d3d3d3"

            onButtonPressed: {
                locationBtn.gradientColor = pressedColor
            }

            onButtonReleased: {
                locationBtn.gradientColor = releasedColor
            }

        }

        A_Button{       // 启动锯片
            id: startSawBtn
            anchors.left: parent.left
            anchors.leftMargin: 420
            anchors.verticalCenter: parent.verticalCenter
            buttonWidth: 170
            buttonHeight: 90
            buttonContent: qsTr("锯 片")
            fontSize: 30
            contentColor: "white"
            buttonBorder: 2
            buttonBorderColor: "#d3d3d3"

            onButtonPressed: {
                startSawBtn.gradientColor = pressedColor
            }

            onButtonReleased: {
                startSawBtn.gradientColor = releasedColor
            }
        }

        A_Button{       // 锯片工进
            id: outSawBtn
            anchors.left: parent.left
            anchors.leftMargin: 620
            anchors.verticalCenter: parent.verticalCenter
            buttonWidth: 170
            buttonHeight: 90
            buttonContent: qsTr("锯 切")
            fontSize: 30
            contentColor: "white"
            buttonBorder: 2
            buttonBorderColor: "#d3d3d3"

            onButtonPressed: {
                outSawBtn.gradientColor = pressedColor
            }

            onButtonReleased: {
                outSawBtn.gradientColor = releasedColor
            }
        }

        A_Button{       // 复位按钮
            id: resetBtn
            anchors.right: parent.right
            anchors.rightMargin: 30
            anchors.verticalCenter: parent.verticalCenter
            buttonWidth: 170
            buttonHeight: 90
            buttonContent: qsTr("复 位")
            fontSize: 30
            contentColor: "white"
            buttonBorder: 2
            buttonBorderColor: "#d3d3d3"

            onButtonPressed: {
                resetBtn.gradientColor = pressedColor
            }

            onButtonReleased: {
                resetBtn.gradientColor = releasedColor
            }
        }

    }



}
